/*
 * Cell.cpp
 *
 *  Created on: 04/01/2012
 *      Author: luiz
 */

#include <sstream>

#include "Cell.h"

Cell::Cell(int id):cell_id_(id){
    cell_function_ = NORMAL_CELL_FUNCTION;
    cell_clock_zone_ = CLOCK_ZONE_0;
    cell_polarization_ = POLARIZATION_0;
    cell_name_ = "";
}

Cell::Cell(const Cell & cell)
{
    cell_clock_zone_ = cell.cell_clock_zone_;
    cell_function_ = cell.cell_function_;
    cell_id_ = cell.cell_id_;
    cell_name_ = cell.cell_name_;
    cell_position_ = cell.cell_position_;
}

Cell & Cell::operator =(const Cell & cell)
{
    if(this == &cell){
        return *this;
    }

    cell_clock_zone_ = cell.cell_clock_zone_;
    cell_function_ = cell.cell_function_;
    cell_id_ = cell.cell_id_;
    cell_name_ = cell.cell_name_;
    cell_position_ = cell.cell_position_;
    return *this;
}


Cell::~Cell() {

}

void Cell::set_cell_function(CELL_FUNCTION cell_function)
{
    cell_function_ = cell_function;
}

void Cell::set_cell_id(int id)
{
    cell_id_ = id;
}

Cell::CELL_FUNCTION Cell::cell_function()
{
    return cell_function_;
}

int Cell::cell_id()
{
    return cell_id_;
}

void Cell::set_cell_clock_zone(CLOCK_ZONE zone)
{
    cell_clock_zone_ = zone;
}

Cell::CLOCK_ZONE Cell::cell_clock_zone()
{
    return cell_clock_zone_;
}


Position Cell::cell_position() const
{
    return cell_position_;
}

int Cell::cell_position_horizontal()
{
    return cell_position_.x();
}

int Cell::cell_position_vertical()
{
    return cell_position_.y();
}

void Cell::set_cell_position(const Position & position)
{
    cell_position_ = position;
}

void Cell::set_cell_position(int horizontal_position, int vertical_position)
{
    cell_position_ = Position(horizontal_position,vertical_position);
}


Cell::CELL_POLARIZATION Cell::cell_polarization() const
{
    return cell_polarization_;
}

void Cell::set_cell_polarization(CELL_POLARIZATION cellPolarization)
{
    cell_polarization_ = cellPolarization;
}

void Cell::set_cell_name(const std::string & name)
{
    cell_name_ = name;
}

std::string Cell::cell_name()
{
    return cell_name_;
}


std::string Cell::print_cell()
{
    std::stringstream oss;
    oss << "["<< cell_id_<< ":(" << cell_position_.x() << "," << cell_position_.y() << "):" << cell_function_  << ":" << cell_clock_zone_  << "]" ;
    return oss.str();
}


